﻿using System;
using System.ComponentModel;
using System.Web.UI;
using System.Collections;
using System.Collections.Generic;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.Core;

namespace Yuanlin.Business
{
    public class CompanyTechnologyDetail : YuanlinUserControl,
        IReplyConverter<CompanyTechnologyReply, GetOperation>
    {
        protected Repeater list;
        private CompanyTechnology companyTechnology;

        public override void GetRequests(List<BaseRequestBinder> requestBinders)
        {
            requestBinders.Add(RequestHelper.BuildGetCompanyTechnologyRequest(this));
        }

        private void BindData()
        {
            EntityList companyTechnologys = new EntityList()  ;

            if (companyTechnology != null)
            {
                companyTechnologys.Add(companyTechnology);
            }

            list.DataSource = companyTechnologys;
            list.DataBind();
        }

        #region IReplyConverter<CompanyTechnologyReply,GetOperation> Members

        public void ConvertReply(CompanyTechnologyReply reply, GetOperation operation)
        {
            if (reply != null)
            {
                companyTechnology = reply.Entity as CompanyTechnology;

                if (!IsPostBack)
                {
                    BindData();
                }
            }
        }

        #endregion
    }
}
